#pragma once
#include"标头.h"

struct Node {
	string data;
	Node* next = NULL;
	int count_1;
	int count_2;
};
class hashList {

private:
	int sumVectorQuantity_1[MAXSIZE];//代码一总向量
	int sumVectorQuantity_2[MAXSIZE];
	int VectorQuantity_1[40];//代码一关键字向量
	int VectorQuantity_2[40];//代码二关键字向量
	int length;
	int count;//访问是否建立用户标志词建立为1，不然为0
	int user_VectorQuantity_1[40];//标志词向量
	int user_VectorQuantity_2[40];//标志词向量
	int user_length;//标志词个数
	Node* hx[MAXSIZE];
public:
	
	//关键词
	string keywords[40] = { "asm","auto","break","case","cdecl","char",
							   "const","continue","default","do","double",
							   "else","enum","extern","far","float","for",
							   "goto","huge","if","int","interrupt","long",
							   "near","pascal","register","return","short",
							   "signed","sizeof","static","struct","switch",
							   "typedef","union","unsigned","void","volatile",
							   "while" ,"include" };
	string user_keywords[MAXSIZE];//用户关键词
	hashList();
	~hashList();
	Node* Search_1(string a);//hash查找
	Node* Search_2(string a);
	string trim(string str);//去除空格
	int H(string a);//hash函数
	void insert_1();//hash插入
	void insert_2();
	void split_1();//分解代码
	void split_2();
	void CompositeVector();//合成关键字向量
	void printVector();//输出关键词
	void creatUser();//输入用户标志词
	void user_CompositeVector();//合成用户关键词向量
	void user_printVector();//输出用户关键词向量
	void combine(hashList& B);//合并关键字向量与用户标志词向量
	void printsumVectorQuantity(hashList& B);//输出总向量
	void printKeywordsCount();//验证哈希函数的冲突次数
	double EuclildeanDistance(hashList& B);//欧氏距离
	double Euclildeansimilarity(hashList& B);//欧式相似度
	double streetDistance(hashList& B);//街区距离
	double streetsimilarity(hashList& B);//街区相似度
	void printcount_1();//输出代码一关键字表
	void printcount_2();//输出代码二关键字表
	void user_printcount_1();//输出代码一关键字表
	void user_printcount_2();
	void menu(); //主菜单
	int getcount();
	
};